import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, exportExcelAxios } from "@/utils/request.ts";
/* 拜访打卡 地址*/
const url = "/back/visit";
/* 获取 拜访打卡列表 */
export const getVisitInfo = <T, D>(params: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 获取 拜访打卡详情 */
export const getVisitByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 拜访打卡添加回访记录 */
export const putUpdateRemarkInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-remark", params, "PUT");
};
/* 导出拜访打卡列表 */
export const putVisitExportInfo = <D>(params: D): Promise<Blob> => {
  return exportExcelAxios<D>(url + "/export", "GET", params);
};
